package sctu.edu.java.year2016.team05.zengkun.day20160601.chapter9_1;

import java.util.Scanner;

/**
 * 创建一个类，并在类中创建一个成员内部类，通过成员内部类计算1到任意数的和操作，并在外部类中进行测试。
 * Created by mike on 2016/6/1.
 */
public class OutClass {


    class innerClass {
        int b;

        public void clate(int a) {
            b = (1 + a) * a / 2;

        }

        public void Calucate()

        {
            System.out.println("一个数求其到1的和：" + b);
        }
    }


    public static void main(String[] args) {
        OutClass out = new OutClass();
        OutClass.innerClass Caulate = out.new innerClass();
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数求其到1的和：");
        int a = scanner.nextInt();
        Caulate.clate(a);
        Caulate.Calucate();
    }

}
